package com.mywork.activity;

import android.content.Context;
import android.util.DisplayMetrics;
import android.view.View;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.TextView;

import com.ciko.code.base.BaseActicity;
import com.mywork.R;

/**
 * 签到结果
 * Created by Administrator on 2016/6/28.
 */
public class ScanResultsActivity extends BaseActicity {
    private ImageView iv_aign_status;
    private TextView tv_agin_status;
    private Button bt_scan;
    private Context context;

    @Override
    protected void initTopBar() {
        setTitle(getResources().getString(R.string.scan_title));
        enableNavLeftImg();
    }

    @Override
    protected void initLayout() {
        setContentView(R.layout.activity_scan_results);
        context = this;
    }

    @Override
    protected void initView() {
        iv_aign_status = findViewByID(R.id.iv_scan_state);
        tv_agin_status = findViewByID(R.id.tv_sign_status);
        bt_scan = findViewByID(R.id.btn_scan);
        int status = getIntent().getIntExtra("status_code", 1001);
        switch (status) {
            case 1000:
                iv_aign_status.setImageResource(R.drawable.sign_success);
                tv_agin_status.setText(getResources().getString(R.string.sign_success));
                bt_scan.setVisibility(View.GONE);
                break;
            case 4001:
                iv_aign_status.setImageResource(R.drawable.sign_fail);
                tv_agin_status.setText(getResources().getString(R.string.sign_repeat));
                bt_scan.setVisibility(View.VISIBLE);
                break;
            case 1011:
            case 4002:
                iv_aign_status.setImageResource(R.drawable.sign_fail);
                tv_agin_status.setText(getResources().getString(R.string.sign_fail));
                bt_scan.setVisibility(View.VISIBLE);
                break;
            default:
                iv_aign_status.setImageResource(R.drawable.sign_fail);
                tv_agin_status.setText(getResources().getString(R.string.sign_error));
                bt_scan.setVisibility(View.VISIBLE);
                break;
        }
    }

    @Override
    protected void initAdapter() {
        DisplayMetrics dm = new DisplayMetrics();
    }

    @Override
    protected void initDates() {

    }

    @Override
    protected void initListener() {
        bt_scan.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
//                startActivity(new Intent(context, MipcaActivityCapture.class));
                finish();
            }
        });
    }
}
